avoid a sign-extension bug in crypto_hash_function
authorJim Meyering <meyering@redhat.com>
Sat, 28 May 2011 12:19:08 +0000 (14:19 +0200)
committerJim Meyering <meyering@redhat.com>
Sat, 28 May 2011 12:19:08 +0000 (14:19 +0200)
commit34ca5e9cb3c859afb0c570b0a59bb37429fa1999
tree70e50ff3abfb451178f65a4befdbd1c6931c6783
parent00085cbc5cf4cc3d1ef99ca5ddff326c8b82c901
avoid a sign-extension bug in crypto_hash_function

* fns.c (to_uchar): Define.
(crypto_hash_function): Use it to convert some newly-signed
variables to unsigned, to avoid sign-extension bugs.  For example,
without this change, (md5 "truc") would evaluate to
45723a2aff78ff4fff7fff1114760e62 rather than the expected
45723a2af3788c4ff17f8d1114760e62.  Reported by Antoine Levitt in
http://thread.gmane.org/gmane.emacs.devel/139824
src/ChangeLog
src/fns.c